from django.utils.deprecation import MiddlewareMixin


class CorsMiddleware(MiddlewareMixin):
    def process_response(self, request, response):
        print('request.method:', request.method)
        if request.method == 'OPTIONS':
            response['Access-Control-Allow-Headers'] = 'Content-Type'
        response['Access-Control-Allow-Origin'] = 'http://127.0.0.1:8041'
        # response['Access-Control-Allow-Origin'] = '*'
        return response
